<?php
require_once '../entity/Questao.php';
require_once '../entity/Banca.php';
require_once '../entity/AssuntoDisciplina.php';
require_once '../entity/Banca.php';
require_once '../entity/Cargo.php';
require_once '../entity/Orgao.php';
require_once '../entity/Resposta.php';
require_once '../entity/TipoQuestao.php';

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ModelQuestao
 *
 * @author David
 */
class ModelQuestao extends Model {

    public function getUltimaQuestao() {
        $this->sql = "SELECT max(codigo) as questao FROM questao;";

        $stmt = $this->p->prepare($this->sql);
        $res = $stmt->execute();

        $result = [];
        if ($res != 1) {
            $result = "erro";
        } else {
            while ($linha = $stmt->fetch()) {
                $result = $linha["questao"];
            }
        }

        return $result;
    }

}